﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using Boxi.ViewModel;
using Boxi.Model;
using Microsoft.Phone.Shell;
using System.Xml;
using System.Xml.Serialization;
using System.IO;
using System.IO.IsolatedStorage;
//using System.IO.IsolatedStorage.IsolatedStorageFile;

namespace Boxi.State
{
    public static class Current
    {
        //private const String GameOptionsStateKey = "GameOptions";
        //private const String PlayerOptionsStateKey = "PlayerOptions";

        //public static void SaveGameState(GameView game)
        //{
        //    using (var store = IsolatedStorageFile.GetUserStoreForApplication()){
        //        using (var stream = new IsolatedStorageFileStream("GameOptions.txt", FileMode.OpenOrCreate,  FileAccess.Read,   store)) {
        //            using (var reader = new StreamReader(stream))  
        //            {   
        //                return reader.EndOfStream   ? new Notebook() 
        //                (Notebook) _serializer.Deserialize(reader); 
        //            }
        //        }
        //    }

        //    if (PhoneApplicationService.Current.State.ContainsKey(GameStateKey))
        //        PhoneApplicationService.Current.State[GameStateKey] = game;
        //    else
        //        PhoneApplicationService.Current.State.Add(GameStateKey, game);
        //}
        //public static void RemoveGameState()
        //{
        //    PhoneApplicationService.Current.State.Remove(GameStateKey);
        //}
        //public static GameView RestoreGameState()
        //{
        //    using (var store = IsolatedStorageFile.GetUserStoreForApplication()) 
        //    using (var stream = new IsolatedStorageFileStream("data.txt", FileMode.Create,  FileAccess.Write, store)) 
        //    {  
        //        var serializer = new System.Xml.Serialization.XmlSerializer(typeof(Notebook));  
        //        serializer.Serialize(stream, notebook

        //     using (var store = IsolatedStorageFile.GetUserStoreForApplication()){
        //        using (var stream = new IsolatedStorageFileStream("GameOptions.txt", FileMode.OpenOrCreate,  FileAccess.Read,   store)) {
        //            using (var reader = new StreamReader(stream))  
        //            {   
        //                return reader.EndOfStream   ? new Notebook() 
        //                (Notebook) _serializer.Deserialize(reader); 
        //            }
        //        }
        //    }
        //}
    }
}
